<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <father></father>
    </div>
    <script src="./node_modules/vue/dist/vue.js"></script>
    <script>
        let m2 = {
            props: ["c"],
            template: "<div>m2 -- {{c}}</div>",
            created() {
                console.log("m2------", this.$listeners)
                this.$listeners.f1()
            }
        }

        let m1 = {
            props: ["b"],
            template: '<div>m --- {{b}} -- <m2 v-bind="$attrs" v-on="$listeners"></m2></div>',
            components: {
                m2,
            },
            created() {
                console.log("m1----",this.$props)
                console.log("m1----", this.$listeners)
            }
        }


        let son = {
            props: ["a"],
            template: "<div>son---  --- {{a}} ---<m1 v-bind='$attrs' v-on='$listeners'></m1></div>",
            components: {
                m1
            },
            mounted() {
                console.log(this.$props)
                console.log(this.$listeners)
            }
        }

        let father = {
            template: "<div>Father<son :a=a :b=b :c=c @f1='f1' @f2='f2' @f3='f3'></son></div>",
            components: {
                son
            },
            data() {
                return {
                    a: 1,
                    b: 2,
                    c:3
                }
            },
            methods: {
                f1() {
                    console.log("f1")
                },
                f2() {
                    console.log("f2")
                },
                f3() {
                    console.log("f3")
                }
            }
        }

        const app = new Vue({
            el: "#app",
            components: {
                father
            },
            data: {

            }
        })
    </script>
</body>
</html>